<%@page import="com.ykfk.cngrain.tbw.SysParameter"%>
<%@page import="com.ykfk.cngrain.tbw.model.TbManager"%>
<%@ page language="java"  pageEncoding="utf-8"%>
<%
String checkloginid = "";
String checkloginpwd = "";
TbManager tbManager = (TbManager)session.getAttribute(SysParameter.sessionObj);
if(tbManager!=null){
	checkloginid = tbManager.getLoginid();
	checkloginpwd = tbManager.getPwd();
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="${pageContext.request.contextPath}/res/css/login/loginin.css" rel="stylesheet" type="text/css" />
		<title>用户登录</title>
		<%@ include file="/common.jsp"%>
	</head>
	<script type="text/javascript">
		var checkloginid = '<%= checkloginid %>';
		var checkloginpwd = '<%= checkloginpwd %>';
		
		$(function(){
			if(checkloginid.length>0){
				$('#loginid').attr("value",checkloginid);
				$('#userpwd').attr("value",checkloginpwd);
				$("form").attr("action","${pageContext.request.contextPath}/login.do");
				$("form").submit();
				return;
			}
			var msg = '${msg}';
			if(!isNUll(msg))
				$('#loginbot').html(msg);
		});
		
		function submit_onclick(){
			var loginid = $('#loginid').val();
			var userpwd = $('#userpwd').val();
			if(isNUll(loginid)){
				$('#loginid').focus();
				$('#loginbot').html("用户名不能为空");
			}else if(isNUll(userpwd)){
				$('#userpwd').focus();
				$('#loginbot').html("用户密码不能为空");
			}else{
				$("form").submit();
			}
		}
		
		function loginOnKey(e) {
            var key = window.event ? e.keyCode : e.which;
            if (key == 13) {
            	$("form").submit();
            }
        }
	</script>
	<body onkeydown="loginOnKey(event);">
	    <form action="${pageContext.request.contextPath}/login.do" id="myform" method="post">
	    <div class="main">
	        <div class="main_n">
	            <div class="main_n01"></div>
	            <div class="main_n02">
	                <div class="zj_land">
	                    <div class="zj_landh">
	                        <span class="zj_landtxt">用户名：</span> <span class="zj_landinput">
	                            <input type="text" class="zj_input_block" name="loginid" id="loginid"/>
	                        </span>
	                    </div>
	                    <div class="zj_landh">
	                        <span class="zj_landtxt">密&nbsp;&nbsp;码：</span> <span class="zj_landinput">
	                            <input type="password" name="userpwd" id="userpwd" class="zj_input_block"/>
	                        </span>
	                    </div>
	                    <div class="zj_annvh">
	                        <input type="button" id="submit1" class="bluean" value="登录" OnClick="submit_onclick()" />
	                        <input type="reset" value="重置" class="bluean" />
	                    </div>
	                </div>
	            </div>
	            <div class="main_n03">
	            	<center><div id="loginbot" style="color: red;"></div></center>
	                <div class="bqxx">
	                    Copyright 2011 State Grain Administration,All right reserved<br />
	                   	 技术支持：郑州华粮科技股份有限公司
	                </div>
	            </div>
	        </div>
	    </div>
	    </form>
	</body>
</html>
